<extend name="Public/base"/>

<block name="body">
    <div class="main-title">
        <h2>推送模板发布</h2>
    </div>
    <div class="tab-wrap">
        <div class="tab-content">
            <form id="form" action="{:U('')}" method="post" class="form-horizontal" enctype="multipart/form-data">
                <div id="tab1" class="tab-pane tab1 in">
                    <!--TAB S-->
                    <div class="form-item cf">
                        <label class="item-label">模板标题<span class="check-tips">（输入模板的标题）</span></label>
                        <div class="controls">
                            <input type="text" class="text input-large" name="title" value="">
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">模板简码<span class="check-tips">（输入模板的简码）</span></label>
                        <div class="controls">
                            <input type="text" class="text input-large" name="bin" value="">
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">公众号模板ID<span class="check-tips">（输入公众号模板的模板ID）</span></label>
                        <div class="controls">
                            <input type="text" class="text input-large" name="templet" value="">
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">模板跳转url<span class="check-tips">（输入模板跳转url）</span></label>
                        <div class="controls">
                            <input type="text" class="text input-large" name="jump_url" value="">
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">模板参数<span class="check-tips"><a href='#' class='btn btn-primary' id="addspec">添加新参数</a></span></label>
                        <div class="controls">
                            <div style="border: #000 1px solid;" class='data-table table-striped'>
                                <table >
                                    <thead>
                                    <tr>
                                        <th style="width:15%">key</th>
                                        <th style="width:15%">value</th>
                                        <th style="width:15%">颜色编号</th>
                                        <th style="width:15%">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody id="tbodyspec">
                                    <tr>
                                        <td style="width:10%"><input type="text" class="text input-small" style="width:160px;" name="pkeys[]" value="" placeholder="key" ></td>
                                        <td style="width:10%"><input type="text" class="text input-small" style="width:320px;" name="pvalues[]" value="" placeholder="value" ></td>
                                        <td style="width:10%"><input type="text" class="text input-small" style="width:100px;" name="pcolors[]" value="" placeholder="颜色编号" ></td>
                                        <td style="width:6%"></td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>

                    <div class="form-item cf">
                        <label class="item-label">模板详情<span class="check-tips">（输入模板详情）</span></label>
                        <div class="controls">
                            {:hook('adminArticleEdit', array('name'=>'content'))}
                            <textarea name="content">{$data[$field['name']]}</textarea>
                        </div>
                    </div>
                    <!--tab e-->
                </div>
                <div class="form-item cf">
                    <button class="btn submit-btn ajax-post"  id="submit" type="submit" target-form="form-horizontal" autocomplete="off">确认发布</button>
                    <a href="{:U('Pushed/index')}" class="btn btn-return">返 回</a>
                </div>
            </form>
        </div>
    </div>
</block>

<block name="script">
    <script type="text/javascript">
        $(document).ready(function () {
            $('#addspec').click(function () {
                var html = '<tr><td style="width:10%"><input type="text" class="text input-small" style="width:160px;" name="pkeys[]" value="" placeholder="key" ></td><td style="width:10%"><input type="text" class="text input-small" style="width:160px;" name="pvalues[]" value="" placeholder="value" ></td><td style="width:10%"><input type="text" class="text input-small" style="width:160px;" name="pcolors[]" value="" placeholder="颜色编号" ></td><td style="width:6%"><a href="#" class="btn btn-primary trdelspec">删除</a></td></tr>';
                $('#tbodyspec').append(html);

                $('.trdelspec').bind("click", function () {
                    $(this).parent().parent().remove();
                });
            });
        });

        highlight_subnav('{:U('Pushed/index')}');
    </script>
</block>